# Contributor: Olliver Schinagl <oliver@schinagl.nl>
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname='arj'
pkgver='0_git20220125'
_commit='e0362c432615a2db2758f6917e451216f693d55f'
pkgrel=1
pkgdesc='Open source implementation and maximum compatible of the world-famous ARJ archiver.'
url='https://arj.sourceforge.net/'
arch='all !armv7 !armhf !x86' # 32 bit builds seem to segfault
license='GPL-2.0-or-later'
options='!check' # tests performed as part of build
makedepends='autoconf automake git rsync'
subpackages="${pkgname}-doc"
source="${pkgname}-${pkgver}.tar.gz::https://gitlab.alpinelinux.org/mirror/arj/-/archive/${_commit}/arj-${_commit}.tar.gz"
builddir="${srcdir}/${pkgname}-${_commit}"

prepare() {
	default_prepare

	(
		cd gnu
		aclocal
		autoupdate
		autoconf
		# Included files are horribly outdated and are unable to build.
		update_config_guess
		update_config_sub

		./configure \
		            --build="${CBUILD}" \
		            --host="${CHOST}" \
		            --mandir='/usr/share/man' \
		            --prefix='/usr' \
		            --sysconfdir='/etc' \
		            ;
	)
	make prepare
}

build() {
	make -j1
}

package() {
	make DESTDIR="${pkgdir}" install

	find "${pkgdir}" -name 'arj-register*' -delete
}

sha512sums="
ca200f0c782763435a51ea077e30eaf0f684b881d1f97f21dc4671b20a0abea37b8b3f458ece7640c98bbe5b06e0ceb72ac11ffbcc1ebc0f67b46d15e96f7ea2  arj-0_git20220125.tar.gz
"
